/* ************************************************************************
 *       Filename:  test.c
 *    Description:  
 *        Version:  1.0
 *        Created:  2014年02月20日 02时35分36秒
 *       Revision:  none
 *       Compiler:  gcc
 *         Author:  YOUR NAME (), 
 *        Company:  
 * ************************************************************************/


#include <string.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
	char buf[]="1:123:ZZL:machine:123:haha";

	char name[100]="";
	char machine_name[100]="";
	char cmd_num[100];
	char add[100]="";
	int test;
	sscanf(buf,"[^:]:[^:]:[^:]:[^:]:[^:]:%[^:]:%s",\
			cmd_num,add);

	printf("machine_name is %s\n",machine_name);
	printf("cmd_num is %d\n",atoi(cmd_num));
	printf("add is %s\n",add);
	bzero(buf,sizeof(buf));
	sscanf("abc#def@ghi", "%*[^#]#%[^@]", buf);
	printf("%s\n", buf);
	return 0;
}


